<%--
  Created by IntelliJ IDEA.
  User: 29276
  Date: 2021/8/20
  Time: 19:29
  To change this template use File | Settings | File Templates.
--%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    //http://localhost:8080/01_sxtoa_war_exploded/
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#signIn").click(function () {
                $.post("dutyServlet", {methodName: "signIn"}, function (data) {
                    if (data === "sessionTimeOut") {
                        window.location.href="login.jsp";
                        return;
                    }
                    console.log(data);
                    if (data === '1') {
                        alert("签到成功");
                    } else if (data === '2') {
                        alert("签到失败");
                    } else {
                        alert("已签到");
                    }
                })

            })

            $("#signOut").click(function () {
                $.post("dutyServlet", {methodName: "signOut"}, function (data) {
                    if (data === "sessionTimeOut") {
                        window.location.href="login.jsp";
                        return;
                    }
                    console.log(data);
                    if (data === '1') {
                        alert("签退成功");
                    } else if (data === '2') {
                        alert("签退失败");
                    } else {
                        alert("请先签到");
                    }
                })

            })
        })

    </script>
</head>

<body>

<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">考勤管理</a></li>
        <li><a href="#">签到签退</a></li>
    </ul>
</div>

<div class="formbody">

    <div class="formtitle"><span>基本信息</span></div>

    <ul class="forminfo">
        <li><label>&nbsp;</label><input id="signIn" name="" type="button" class="btn" value="签到"/> 每天签到一次，不可重复签到</li>
        <li><label>&nbsp;</label></li>
        <li><label>&nbsp;</label></li>
        <li><label>&nbsp;</label><input id="signOut" name="" type="button" class="btn" value="签退"/>可重复签退，以最后一次签退为准</li>
    </ul>


</div>


</body>

</html>

